package com.fzk.rocketmq;


import com.alibaba.fastjson2.JSON;
import lombok.Data;

import java.io.InputStream;
import java.util.Properties;

/**
 * @author zhike.feng
 * @datetime 2024-03-03 18:19:20
 */
@Data
public class RocketMQConf {
    public static final String confPath = "rocketmq.properties";
    private String endpoint;
    private String topic;
    private String accessKey;
    private String accessSecret;
    private String key;
    private String tag;
    private String content;
    private String consumerGroup;

    public static RocketMQConf getConf() {
        try (InputStream in = RocketMQConf.class.getClassLoader().getResourceAsStream(confPath)) {
            Properties properties = new Properties();
            properties.load(in);
            return JSON.parseObject(JSON.toJSONBytes(properties), RocketMQConf.class);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
